package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author huanghui
 * @since 2023-07-25
 */
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
@Api(tags = "用户端互动互答相关接口")
public class InteractionReplyController {

    private final IInteractionReplyService replyService;


    /** @author ZXX-挚爱
    * @Description 新增回答或评论
    * @Dete 2:43 2023/7/26
    * @Param [replyDTO]
    * @return void
    **/

    @ApiOperation("新增回答或评论")
    @PostMapping
    public void saveReply(@RequestBody ReplyDTO replyDTO) {
        replyService.saveReply(replyDTO);
    }

    /** @author ZXX-挚爱
    * @Description 分页查询回答或评论
    * @Dete 2:44 2023/7/26
    * @Param [pageQuery]
    * @return com.tianji.common.domain.dto.PageDTO<com.tianji.learning.domain.vo.ReplyVO>
    **/

    @ApiOperation("用戶端分页查询回答或评论")
    @GetMapping("page")
    public PageDTO<ReplyVO> queryReplyPage(ReplyPageQuery pageQuery){
        return replyService.queryReplyPage(pageQuery, false);
    }

}
